# -*- coding: utf-8 -*-
from django.db import models
from apps.prewarning.models import *
from apps.gis_analysis.models import SpecialArea, ThunderInfo


class Fault(models.Model):
    """故障"""
    code = models.CharField('故障编码', max_length=20)
    name = models.CharField('故障名称', max_length=40)
    remarks = models.TextField('故障描述', null=True, blank=True)
 
    def __unicode__(self):
        return self.name
 
    class Meta:
        verbose_name = '故障表'
        verbose_name_plural = '指挥阶段|故障表(Fault)'


class CompositeData(models.Model):
    """综合数据展示"""
    fault = models.ForeignKey(Fault, verbose_name='故障')
    atmosphere = models.ForeignKey(AtmosphereMonitor, verbose_name='微气象',
            null=True, blank=True)
    leadtemperature = models.ForeignKey(LeadTemperatureMonitor,verbose_name='导线温度',
            null=True, blank=True)
    salt = models.ForeignKey(SaltMonitor, verbose_name='盐密值',
            null=True, blank=True)
    thunderinfo = models.ForeignKey(ThunderInfo, verbose_name='雷电信息',
            null=True, blank=True)
    special_area = models.ForeignKey(SpecialArea, verbose_name='特殊区域',
            null=True, blank=True)
    
    def __unicode__(self):
        return self.fault

    class Meta:
        verbose_name = '综合数据展示'
        verbose_name_plural = '指挥阶段|综合数据展示(CompositeData)'
